package com.okami.controller;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: TanJingyu
 * @create: 2020-12-16 11:40
 **/
@RestController
@RequestMapping("/amqp")
public class AmqpController {
    private final RabbitTemplate rabbitTemplate;

    public AmqpController(@Autowired(required = false) RabbitTemplate rabbitTemplate) {
        this.rabbitTemplate = rabbitTemplate;
    }

    @GetMapping
    public String amqp() {
//        MessageProperties properties = new MessageProperties();
//        properties.setMessageId("");
//        Message message = new Message("".getBytes(), properties);
//        rabbitTemplate.send(message);
        return "success";
    }
}
